﻿using System;
using NumericalMatrix.GenericInterfaces;

namespace NumericalMatrix.Implementation
{
    class DoubleOperations : IGroupOperations<double>
    {
        /// <summary>
        /// Gets the addition.
        /// </summary>
        /// <value>The addition.</value>
        public Func<double, double, double> Addition
        {
            get
            {
                return (x, y) => x + y;    
            }
        }

        /// <summary>
        /// Gets the subtraction.
        /// </summary>
        /// <value>The subtraction.</value>
        public Func<double, double, double> Subtraction
        {
            get
            {
                return (x, y) => x - y;
            }
        }

        /// <summary>
        /// Gets the multiplication.
        /// </summary>
        /// <value>The multiplication.</value>
        public Func<double, double, double> Multiplication
        {
            get
            {
                return (x, y) => x * y;
            }
        }

        /// <summary>
        /// Gets the scalar multiplication.
        /// </summary>
        /// <value>The scalar multiplication.</value>
        public Func<double, double, double> ScalarMultiplication
        {
            get
            {
                return (d, x) => d * x;
            }
        }

        /// <summary>
        /// Gets the division.
        /// </summary>
        /// <value>The division.</value>
        public Func<double, double, double> Division
        {
            get
            {
                return (x, y) => x / y;
            }
        }

        public double NeutralElement
        {
            get 
            {
                return 1;
            }
        }

        public double ZeroElement
        {
            get
            {
                return 0;
            }
        }
    }
}
